--状态栏插件

local status, lualine = pcall(require, 'lualine')
if (not status) then 
  vim.notify("没有安装lualine组件")
  return 
end

lualine.setup {
  options = {
    icons_enabled = true,
    theme = 'tokyonight',
    section_separators = { left = '', right = '' },
    component_separators = { left = '', right = ''},
    --section_separators = { left = '', right = '' },
    --component_separators = { left = '|', right = '|' },
    disabled_filetypes = {
      statusline = {},
      winbar = {},
    },
    ignore_focus = {},
    always_divide_middle = true,
    globalstatus = false,
    refresh = {
      statusline = 1000,
      tabline = 1000,
      winbar = 1000,
    }
  },
  sections = {
    lualine_a = { 'mode' },
    lualine_b = { 'branch', 'diff', 'diagnostics' },
    lualine_c = { 
      {
        'filename',
        file_status = true, -- display file status
        path = 1,           -- 0 = just filename
        "lsp_progress",
        spinner_symbols = {" ", " ", " ", " ", " ", " " },
      } 
    },
    lualine_x = {
      "filesize",
      {   
        "fileformat",
        symbols = {   
          unix = '', -- e712
          dos = '', -- e70f
          mac = '', -- e711
        },
        -- symbols = {   
        --   unix = "LF",
        --   dos = "CRLF",
        --   mac = "CR",
        -- },
      },
      'encoding',
      'filetype',
    },
    lualine_y = { 'progress' },
    lualine_z = { 'location' }
  },
  inactive_sections = {
    lualine_a = {},
    lualine_b = {},
    lualine_c = {'filename'},
    lualine_x = {'location'},
    lualine_y = {},
    lualine_z = {}
  },
  tabline = {},
  winbar = {},
  inactive_winbar = {},
  extensions = { 'nvim-tree', 'trouble', 'lazy' } -- Lualine会根据不同的窗口显示不同的插件
}
